<template>
  <div>
      <McTableTree ref="mcTableTree" :data="data" :build-item="buildItem" children-key="children" :mcTreeNodeWidth="200">
        <el-table-column
          label="命令"
          width="80">
          <template slot-scope="scope">
             <el-input v-model="scope.row.command"></el-input>
          </template>
        </el-table-column>
        <el-table-column
          label="名称"
          width="180">
          <template slot-scope="scope">
             <el-input v-model="scope.row.name"></el-input>
          </template>
        </el-table-column>
      </McTableTree>
      <el-button @click="print">打印</el-button>
      <el-button @click="change">变更</el-button>
  </div>
</template>

<script>
import McTableTree from './components/McTableTree'
export default {
    data(){
      return {
          data:[{
            command:'edit',
            name:'编辑',

          },{
            command:'edit',
            name:'编辑',

          }]
		  }
    },
    components:{
      McTableTree,
    },
    methods:{
        print(){
            var data = this.$refs['mcTableTree'].simpleData()
            console.log(data)
        },
        saveData(val){
            console.log(val);
        },
        change(){
            this.data.fields = [{"name":"id","title":"主键"}]
        },
        buildItem(row){
            return {name:"",command:""}
        }
    }
}
</script>

<style>

</style>
